﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Account/Site.master" AutoEventWireup="true" CodeFile="DonHang.aspx.cs" Inherits="Administrator_DonHang" %>

<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" Runat="Server">
    <asp:SiteMapPath ID="SiteMapPath1" runat="server" Font-Names="Verdana" 
        Font-Size="0.8em" PathSeparator=" : " style="font-size: small">
        <CurrentNodeStyle ForeColor="#333333" />
        <NodeStyle Font-Bold="True" ForeColor="#284E98" />
        <PathSeparatorStyle Font-Bold="True" ForeColor="#507CD1" />
        <RootNodeStyle Font-Bold="True" ForeColor="#507CD1" />
    </asp:SiteMapPath>
    <br />
    <asp:Label ID="Label1" runat="server" 
        style="font-size: x-large; font-weight: 700" Text="Quản lý đơn hàng"></asp:Label>
    <br />
    <br />
    <asp:GridView ID="GridView1" runat="server" AllowPaging="True" 
        AllowSorting="True" AutoGenerateColumns="False" BackColor="White" 
        BorderColor="#CCCCCC" BorderStyle="None" BorderWidth="1px" CellPadding="3" 
        DataKeyNames="ID" DataSourceID="SqlDataSource1" EnableModelValidation="True" 
        Width="100%">
        <Columns>
            <asp:CommandField DeleteText="Xóa" EditText="Sửa" ShowDeleteButton="True" 
                ShowEditButton="True" />
            <asp:HyperLinkField DataNavigateUrlFields="ID" 
                DataNavigateUrlFormatString="ChiTietDonHang.aspx?ID={0}" 
                DataTextField="HoTenKhach" HeaderText="Họ tên khách hàng" 
                SortExpression="HoTenKhach" />
            <asp:BoundField DataField="NgayGui" HeaderText="Ngày gửi" ReadOnly="True" 
                SortExpression="NgayGui" />
            <asp:BoundField DataField="DiaChi" HeaderText="Địa chỉ" 
                SortExpression="DiaChi" />
            <asp:BoundField DataField="DienThoai" HeaderText="Điện thoại" 
                SortExpression="DienThoai" />
            <asp:BoundField DataField="Email" HeaderText="Email" SortExpression="Email" />
            <asp:BoundField DataField="GhiChu" HeaderText="Ghi chú" 
                SortExpression="GhiChu" />
            <asp:CheckBoxField DataField="TrangThai" HeaderText="Chưa đọc" ReadOnly="True" 
                SortExpression="TrangThai" />
        </Columns>
        <EmptyDataTemplate>
            Không có đơn hàng nào!
        </EmptyDataTemplate>
        <FooterStyle BackColor="White" ForeColor="#000066" />
        <HeaderStyle BackColor="#006699" Font-Bold="True" ForeColor="White" />
        <PagerStyle BackColor="White" ForeColor="#000066" HorizontalAlign="Left" />
        <RowStyle ForeColor="#000066" />
        <SelectedRowStyle BackColor="#669999" Font-Bold="True" ForeColor="White" />
    </asp:GridView>
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
        ConnectionString="<%$ ConnectionStrings:ConnectServer %>" DeleteCommand="DELETE FROM [ChiTietDonHang] WHERE [DonHangID] = @ID
DELETE FROM [DonHang] WHERE [ID] = @ID
" 
        InsertCommand="INSERT INTO [DonHang] ([NgayGui], [HoTenKhach], [DiaChi], [DienThoai], [Email], [GhiChu], [TrangThai]) VALUES (@NgayGui, @HoTenKhach, @DiaChi, @DienThoai, @Email, @GhiChu, @TrangThai)" 
        SelectCommand="SELECT * FROM [DonHang]" 
        UpdateCommand="UPDATE [DonHang] SET [NgayGui] = @NgayGui, [HoTenKhach] = @HoTenKhach, [DiaChi] = @DiaChi, [DienThoai] = @DienThoai, [Email] = @Email, [GhiChu] = @GhiChu, [TrangThai] = @TrangThai WHERE [ID] = @ID">
        <DeleteParameters>
            <asp:Parameter Name="ID" Type="Int32" />
        </DeleteParameters>
        <InsertParameters>
            <asp:Parameter Name="NgayGui" Type="DateTime" />
            <asp:Parameter Name="HoTenKhach" Type="String" />
            <asp:Parameter Name="DiaChi" Type="String" />
            <asp:Parameter Name="DienThoai" Type="String" />
            <asp:Parameter Name="Email" Type="String" />
            <asp:Parameter Name="GhiChu" Type="String" />
            <asp:Parameter Name="TrangThai" Type="Boolean" />
        </InsertParameters>
        <UpdateParameters>
            <asp:Parameter Name="NgayGui" Type="DateTime" />
            <asp:Parameter Name="HoTenKhach" Type="String" />
            <asp:Parameter Name="DiaChi" Type="String" />
            <asp:Parameter Name="DienThoai" Type="String" />
            <asp:Parameter Name="Email" Type="String" />
            <asp:Parameter Name="GhiChu" Type="String" />
            <asp:Parameter Name="TrangThai" Type="Boolean" />
            <asp:Parameter Name="ID" Type="Int32" />
        </UpdateParameters>
    </asp:SqlDataSource>
</asp:Content>

